/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author edgar
 */
@Entity
@Table(name = "articulos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Articulos.findAll", query = "SELECT a FROM Articulos a"),
    @NamedQuery(name = "Articulos.findByCodArticulo", query = "SELECT a FROM Articulos a WHERE a.codArticulo = :codArticulo"),
    @NamedQuery(name = "Articulos.findByDescripcion", query = "SELECT a FROM Articulos a WHERE a.descripcion = :descripcion"),
    @NamedQuery(name = "Articulos.findByNroParte", query = "SELECT a FROM Articulos a WHERE a.nroParte = :nroParte"),
    @NamedQuery(name = "Articulos.findByPrecio", query = "SELECT a FROM Articulos a WHERE a.precio = :precio"),
    @NamedQuery(name = "Articulos.findByCodOrigen", query = "SELECT a FROM Articulos a WHERE a.codOrigen = :codOrigen"),
    @NamedQuery(name = "Articulos.findByCostoCalculado", query = "SELECT a FROM Articulos a WHERE a.costoCalculado = :costoCalculado"),
    @NamedQuery(name = "Articulos.findBySaldoActual", query = "SELECT a FROM Articulos a WHERE a.saldoActual = :saldoActual"),
    @NamedQuery(name = "Articulos.findByPorcentajeIva", query = "SELECT a FROM Articulos a WHERE a.porcentajeIva = :porcentajeIva"),
    @NamedQuery(name = "Articulos.findByCosto1", query = "SELECT a FROM Articulos a WHERE a.costo1 = :costo1"),
    @NamedQuery(name = "Articulos.findByCosto2", query = "SELECT a FROM Articulos a WHERE a.costo2 = :costo2")})
public class Articulos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @SequenceGenerator(name="ventas_cabecera_nro_factura_seq", sequenceName="ventas_cabecera_nro_factura_seq", allocationSize=1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "ventas_cabecera_nro_factura_seq")
    @Basic(optional = false)
    @Column(name = "cod_articulo")
    private Integer codArticulo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "descripcion")
    private String descripcion;
    @Size(max = 100)
    @Column(name = "nro_parte")
    private String nroParte;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "precio")
    private Float precio;
    @Size(max = 50)
    @Column(name = "cod_origen")
    private String codOrigen;
    @Column(name = "costo_calculado")
    private Integer costoCalculado;
    @Column(name = "saldo_actual")
    private Float saldoActual;
    @Column(name = "porcentaje_iva")
    private Integer porcentajeIva;
    @Column(name = "costo1")
    private Integer costo1;
    @Column(name = "costo2")
    private Integer costo2;
    @JoinColumn(name = "cod_marca", referencedColumnName = "cod_marca")
    @ManyToOne
    private Marcas codMarca;
    @JoinColumn(name = "cod_familia", referencedColumnName = "cod_familia")
    @ManyToOne
    private FamiliaArticulos codFamilia;
    @OneToMany(mappedBy = "codArticulo")
    private List<NotasCreditoDetalle> notasCreditoDetalleList;
    @OneToMany(mappedBy = "codArticulo")
    private List<VentasDetalle> ventasDetalleList;
    @OneToMany(mappedBy = "codArticulo")
    private List<EntradaSalidaArticulos> entradaSalidaArticulosList;
    @OneToMany(mappedBy = "codArticulo")
    private List<OrdenesDetalle> ordenesDetalleList;
    @OneToMany(mappedBy = "codArticulo")
    private List<ComprasDetalle> comprasDetalleList;

    public Articulos() {
    }

    public Articulos(Integer codArticulo) {
        this.codArticulo = codArticulo;
    }

    public Articulos(Integer codArticulo, String descripcion) {
        this.codArticulo = codArticulo;
        this.descripcion = descripcion;
    }

    public Integer getCodArticulo() {
        return codArticulo;
    }

    public void setCodArticulo(Integer codArticulo) {
        this.codArticulo = codArticulo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getNroParte() {
        return nroParte;
    }

    public void setNroParte(String nroParte) {
        this.nroParte = nroParte;
    }

    public Float getPrecio() {
        return precio;
    }

    public void setPrecio(Float precio) {
        this.precio = precio;
    }

    public String getCodOrigen() {
        return codOrigen;
    }

    public void setCodOrigen(String codOrigen) {
        this.codOrigen = codOrigen;
    }

    public Integer getCostoCalculado() {
        return costoCalculado;
    }

    public void setCostoCalculado(Integer costoCalculado) {
        this.costoCalculado = costoCalculado;
    }

    public Float getSaldoActual() {
        return saldoActual;
    }

    public void setSaldoActual(Float saldoActual) {
        this.saldoActual = saldoActual;
    }

    public Integer getPorcentajeIva() {
        return porcentajeIva;
    }

    public void setPorcentajeIva(Integer porcentajeIva) {
        this.porcentajeIva = porcentajeIva;
    }

    public Integer getCosto1() {
        return costo1;
    }

    public void setCosto1(Integer costo1) {
        this.costo1 = costo1;
    }

    public Integer getCosto2() {
        return costo2;
    }

    public void setCosto2(Integer costo2) {
        this.costo2 = costo2;
    }

    public Marcas getCodMarca() {
        return codMarca;
    }

    public void setCodMarca(Marcas codMarca) {
        this.codMarca = codMarca;
    }

    public FamiliaArticulos getCodFamilia() {
        return codFamilia;
    }

    public void setCodFamilia(FamiliaArticulos codFamilia) {
        this.codFamilia = codFamilia;
    }

    @XmlTransient
    public List<NotasCreditoDetalle> getNotasCreditoDetalleList() {
        return notasCreditoDetalleList;
    }

    public void setNotasCreditoDetalleList(List<NotasCreditoDetalle> notasCreditoDetalleList) {
        this.notasCreditoDetalleList = notasCreditoDetalleList;
    }

    @XmlTransient
    public List<VentasDetalle> getVentasDetalleList() {
        return ventasDetalleList;
    }

    public void setVentasDetalleList(List<VentasDetalle> ventasDetalleList) {
        this.ventasDetalleList = ventasDetalleList;
    }

    @XmlTransient
    public List<EntradaSalidaArticulos> getEntradaSalidaArticulosList() {
        return entradaSalidaArticulosList;
    }

    public void setEntradaSalidaArticulosList(List<EntradaSalidaArticulos> entradaSalidaArticulosList) {
        this.entradaSalidaArticulosList = entradaSalidaArticulosList;
    }

    @XmlTransient
    public List<OrdenesDetalle> getOrdenesDetalleList() {
        return ordenesDetalleList;
    }

    public void setOrdenesDetalleList(List<OrdenesDetalle> ordenesDetalleList) {
        this.ordenesDetalleList = ordenesDetalleList;
    }

    @XmlTransient
    public List<ComprasDetalle> getComprasDetalleList() {
        return comprasDetalleList;
    }

    public void setComprasDetalleList(List<ComprasDetalle> comprasDetalleList) {
        this.comprasDetalleList = comprasDetalleList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codArticulo != null ? codArticulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Articulos)) {
            return false;
        }
        Articulos other = (Articulos) object;
        if ((this.codArticulo == null && other.codArticulo != null) || (this.codArticulo != null && !this.codArticulo.equals(other.codArticulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Articulos[ codArticulo=" + codArticulo + " ]";
    }
    
}
